package com.chenjian.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author chenjian
 * @Package
 * @Description:
 * @date 2019/6/30 16:09
 */
@Getter
@AllArgsConstructor
public enum GENDER_ENUM {
    OTHER("0", "未知性别"),
    MEN("1", "男性"),
    WOMEN("2", "女性");
    //性别代码
    private String genderCode;
    //性别描述
    private String genderDesc;

    public static String getGender(String genderStr) {
        GENDER_ENUM[] genderEnums = GENDER_ENUM.values();
        if (null != genderStr) {
            for (GENDER_ENUM genderEnum : genderEnums) {
                if (genderEnum.genderCode.equals(genderStr.trim())) {
                    return genderEnum.getGenderCode();
                }
            }
        }
        return GENDER_ENUM.OTHER.getGenderCode();
    }
}
